<template>
<div class="block">
    <el-tree
      :data="data"
      node-key="cartId"
      :props="defaultProps"
      :expand-on-click-node="false"
      ref="menuTree" @node-click="nodeClick">
    </el-tree>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        data: [],
        defaultProps: {
          children: "children",
          label: "name"
        }
      }
    },
    methods: {
      getMenu(){
        this.$http({
          url: this.$http.adornUrl('/product/category/list/tree'),
          method: 'get',
          params: this.$http.adornParams({

          })
        }).then(({data}) => {
          this.data= data.data;
        })
      },
      nodeClick(data,node,compont){
        this.$emit("tree-node-click",data,node,compont);
      }
    },
    created () {
      this.getMenu();
    }
  }
</script>

